function updtEvtOvShowLst(~,~,f)
% updtEvtOvShowLst update the list of events whose overlay should be shown
% determined by filter and drawn regions

btSt = getappdata(f,'btSt');
ov = getappdata(f,'ov');

%% channel 1
% 每次 .* 运算前确保数组长度一致
name = 'Events_Red'; 
ov0 = ov(name);
nEvt = numel(ov0.sel);
xSel = true(nEvt,1);
if ~isempty(btSt.filterMsk1)
    len = min(length(xSel), length(btSt.filterMsk1));
    xSel = xSel(1:len) .* btSt.filterMsk1(1:len);
    xSel = [xSel; false(nEvt-len,1)];
end
if ~isempty(btSt.regMask1)
    len = min(length(xSel), length(btSt.regMask1));
    xSel = xSel(1:len) .* btSt.regMask1(1:len);
    xSel = [xSel; false(nEvt-len,1)];
end
if ~isempty(btSt.rmLst1)
    msk00 = ones(nEvt,1);
    msk00(btSt.rmLst1(btSt.rmLst1<=nEvt)) = 0;
    xSel = xSel .* msk00;
end
ov0.sel = xSel>0;
ov(name) = ov0;
%% channel 2
name = 'Events_Green';
ov0 = ov(name);
nEvt = numel(ov0.sel);
xSel = true(nEvt,1);
if ~isempty(btSt.filterMsk2)
    len = min(length(xSel), length(btSt.filterMsk2));
    xSel = xSel(1:len) .* btSt.filterMsk2(1:len);
    xSel = [xSel; false(nEvt-len,1)];
end
if ~isempty(btSt.regMask2)
    len = min(length(xSel), length(btSt.regMask2));
    xSel = xSel(1:len) .* btSt.regMask2(1:len);
    xSel = [xSel; false(nEvt-len,1)];
end
if ~isempty(btSt.rmLst2)
    msk00 = ones(nEvt,1);
    msk00(btSt.rmLst2(btSt.rmLst2<=nEvt)) = 0;
    xSel = xSel .* msk00;
end
ov0.sel = xSel>0;
ov(name) = ov0;
setappdata(f,'ov',ov);

ui.movStep(f,[],[],1);

end


